/*
 * Copyright (c) 2021. Moses All Right Reserved
 */

package com.moses.design_patterns.proxy.static_proxy.abstract_proxy;

/**
 * @author Moses
 * @email shenhuohui@gmail.com
 * @date 2021/4/10 18:47
 */
public class Proxy2 extends ProxiedAbstractSubject {
    private ProxiedAbstractSubject subject = null;

    private  void before(){
        System.out.println("事前处理");
    }

    private void after(){
        System.out.println("事后处理");
    }

    public Proxy2(ProxiedAbstractSubject subject){
        this.subject = subject;
    }

    @Override
    public void method() {
        before();
        subject.method();
        after();
    }

    @Override
    public ProxiedAbstractSubject getProxy() {
        return this;
    }
}
